<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>离职管理</title>
<script type="text/javascript" src="static/easyui/jquery.min.js"></script> 
<script type="text/javascript" src="static/easyui/jquery.easyui.min.js"></script>
<script type="text/javascript" src="static/easyui/locale/easyui-lang-zh_CN.js"></script>
<link rel="stylesheet" href="static/easyui/themes/icon.css">
<link rel="stylesheet" href="static/easyui/themes/metro/easyui.css">
	<style type="text/css">
		/* 办理员工离职信息添加 */
		.add-lz{
			background:white;
			color: #1AB394;
		}
		/* 待离职表格里面的按钮 */
		.dlz-faqisp{
			color: #19AA8D;
			border:1px solid #1AB394;
		}
		.dlz-fqlz{
			color: red;
			border:1px solid #1AB394;
		}
		.dlz-qdlz{
			color: #19AA8D;
			border:1px solid #1AB394;
		}
		
		/* 离职审批里面的查看 */
		.lzsp-ck{
			color: #19AA8D;
			border:1px solid #1AB394;
		}
		/* 离职结果表格里面的按钮 */
		.lzjg-ck{
			color: #19AA8D;
			border:1px solid #1AB394;
		}
	
	</style>
</head>
<body>
<script type="text/javascript">
	/* 	var time=new Date();
		var timestamp = time.getYear()+""+time.getMonth()+""+time.getHours();
		$("#rankid").val(timestamp.substring(0,timestamp.length-1)); */
		$(function(){
			$('#rank-table').datagrid({
			    url:'selectdeparture',
			    columns:[[
			    	{field:'staff_id',title:'员工工号',width:150,align:'center'},
					{field:'Staff_name',title:'员工名称',width:150,align:'center'},
					{field:'depart_name',title:'部门',width:100,align:'center'},
					{field:'Staff_phone',title:'电话号码',width:150,align:'center'},
					{field:'Rank_date',title:'离职日期',width:150,align:'center'},
					{field:'Rank_Reason',title:'离职原因',width:150,align:'center'},
					{field:'caozuo',title:'操作',width:250,align:'center',
						formatter: function(value,row,index){
							return "<input type='button' onclick='rankshenhe("+row.Rank_id+","+row.Depart_id+")' style='width: 80px;height: 20px;font-size:12px;border-radius:4px;margin-right:5px;color:#fff;background-color:#18A689;border:1px solid #18A689;' value='点击审核'/>";
						},
					}
			    ]],
			    pagination:true,
			    pageNumber:5,
			    pageSize:5,
			    pageList:[5,10,15]
			});
			
			//审核的信息
			$('#tablejg-rank').datagrid({
			    url:'selectdepartureresult',
			    columns:[[
			    	{field:'staff_id',title:'员工工号',width:150,align:'center'},
					{field:'Staff_name',title:'员工名称',width:150,align:'center'},
					{field:'depart_name',title:'部门',width:100,align:'center'},
					{field:'Staff_phone',title:'电话号码',width:150,align:'center'},
					{field:'Rank_date',title:'离职日期',width:150,align:'center'},
					{field:'rank_shpiresult',title:'审批结果',width:150,align:'center'},
					{field:'caozuo',title:'操作',width:250,align:'center',
						formatter: function(value,row,index){
							if(row.panduan==0){
								return "<input type='button' onclick='showtime("+row.Rank_id+","+row.Depart_id+")' style='width: 80px;height: 20px;font-size:12px;border-radius:4px;margin-right:5px;color:#fff;background-color:#18A689;border:1px solid #18A689;' value='查看'/>"+
								"<input type='button' onClick='shouhui("+row.staff_id+")' style='width: 80px;height: 20px;font-size:12px;border-radius:4px;margin-right:5px;color:#fff;background-color:#18A689;border:1px solid #18A689;' value='收回权限'/>";
							}else if(row.panduan==1){
								return "<input type='button' onclick='showtime("+row.Rank_id+","+row.Depart_id+")' style='width: 80px;height: 20px;font-size:12px;border-radius:4px;margin-right:5px;color:#fff;background-color:#18A689;border:1px solid #18A689;' value='查看'/>";
							}
						},
					}
			    ]],
			    pagination:true,
			    pageNumber:5,
			    pageSize:5,
			    pageList:[5,10,15]
			});
			
		});
		
		function rankshenhe(t,b){
			$.ajax({
				url:"approvaldeparture",
				type:"post",
				data:{"rank_id":t,"Depart_id":b},
				success:function(data){
					$("#content-admin").panel('open').panel('refresh','hr-departureapproval');
				}
			});
		}
			
	function showtime(t,b){
		$.ajax({
			url:"approvaldeparture",
			type:"post",
			data:{"rank_id":t,"Depart_id":b},
			success:function(data){
				$("#content-admin").panel('open').panel('refresh','hr-departureapproval');
			}
		});
	}
	
	function shouhui(t){
		$.ajax({
			url:"updateLizhi",
			type:"post",
			data:{"staff_id":t},
			success:function(data){
				alert("收回成功");
				$('#tablejg-rank').datagrid('reload');
			}
		});
	}
	
	</script>
	<div id="tt" class="easyui-tabs" style="height:560px;;">
	    <div title="离职审批" style="padding:2px;display:none;">
				<table id="rank-table" class="easyui-datagrid" style="height: 460px;">   
				</table>  
	    </div>
	    
	    <div title="离职结果" style="display:none;">
			<table id="tablejg-rank" class="easyui-datagrid" style="height:460px;">   
				 
				</table>
				
	    </div>
	    
    
</div>
</body>
</html>